<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">


<div th:replace="public/base_update :: html"></div>

<body>
<!-- Start Page Loading -->
<div id="loader-wrapper">
    <div id="loader"></div>
    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>
</div>
<!-- End Page Loading -->


<!-- START MAIN -->
<!-- START WRAPPER -->


<!-- START CONTENT -->
<section id="content">

    <!--breadcrumbs start-->
    <div id="breadcrumbs-wrapper" class=" grey lighten-3">
        <div class="container">
            <div class="row">
                <div class="col s12 m12 l12">
                    <h5 class="breadcrumbs-title">Forms</h5>
                    <ol class="breadcrumb">
                        <li><a href="../index.html">Dashboard</a>
                        </li>
                        <li><a href="#">Forms</a>
                        </li>
                        <li class="active">Forms Layouts</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <!--breadcrumbs end-->


    <!--start container-->
    <div class="container">
        <div class="section">

            <p class="caption">Includes predefined classes for easy layout options.</p>

            <div class="divider"></div>
        </div>
    </div>
    <!--Form Advance-->
    <div class="row">
        <div class="col s12 m12 l12">
            <div class="card-panel">
                <h4 class="header2">发布广告</h4>
                <div class="row">
                    <form class="col s12" id="send_form" action="">
                        <input type="hidden" id="id" name="id"  th:value="${dynamiclist.id}">
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="title" name="title" type="text" th:value="${dynamiclist.title}"/>
                                <label for="title">广 告 标 题</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s12">
                                <input id="dynamiclist_content" type="text" name="content" length="300"
                                       th:value="${dynamiclist.content}"/>
                                <label for="content">广 告 内 容</label>
                            </div>
                            <div class="row">
                                <div class="input-field col s12">
                                    <button id="send_btn" class="btn cyan waves-effect waves-light right" type="button"
                                            name="action">提交
                                        <i class="mdi-content-send right"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>


<!-- ================================================
Scripts
================================================ -->

<script th:inline="javascript">

    $("#send_btn").click(function () {

        // $('.input-field col s2').children[0].attr('placeholder')
        var send_form = $('#send_form').serialize();
        // sendform['filed_id']
        console.log(send_form);
        $.ajax({
            type: "post",
            data: send_form,
            url: "/unitlinforbase/dynamiclist/saveOrUpdate.crp",
            dataType: "json",
            success: function (msg) {
                if (msg.success) {
                    Materialize.toast(msg.message, 3000);
                    // dialog.searchPageNotChange();
                     dialog
                        .parentclose(true);
                } else {
                    Materialize.toast(msg.message, 3000);
                }
            },
            error: function (data) {
                Materialize.toast("网络异常");
            }
        });
    });

</script>

</body>

</html>
